Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ksp configuration in projects #849

Merged
merged 2 commits into from
Jan 16, 2024
Merged

Fix ksp configuration in projects #849

merged 2 commits into from
Jan 16, 2024

Conversation

jamowei
Copy link
Collaborator

@jamowei jamowei commented Jan 16, 2024

Fixes implicit dependency errors in Gradle 8.5 by the ksp task.

line that causes the error

kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }

the error message:

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':my-project:kspCommonMainKotlinMetadata' (type 'KspTaskMetadata').
  - Gradle detected a problem with the following location: '/Users/jan/IdeaProjects/oe-auth-service/core/build/generated/ksp/metadata/commonMain/kotlin'.
    
    Reason: Task ':my-project:jvmSourcesJar' uses this output of task ':my-project:kspCommonMainKotlinMetadata' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':my-project:kspCommonMainKotlinMetadata' as an input of ':my-project:jvmSourcesJar'.
      2. Declare an explicit dependency on ':my-project:kspCommonMainKotlinMetadata' from ':my-project:jvmSourcesJar' using Task#dependsOn.
      3. Declare an explicit dependency on ':my-project:kspCommonMainKotlinMetadata' from ':my-project:jvmSourcesJar' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/Users/jan/IdeaProjects/oe-auth-service/core/build/generated/ksp/metadata/commonMain/kotlin'.

line which fixes the error:

kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }

@jamowei jamowei added the dependencies Pull requests that update a dependency file label Jan 16, 2024
@jamowei jamowei requested a review from Lysander January 16, 2024 16:36
@jamowei jamowei self-assigned this Jan 16, 2024
@Lysander Lysander merged commit 3f29115 into master Jan 16, 2024
2 checks passed
@Lysander Lysander deleted the jamowei/ksp branch January 16, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants